﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProcurementManagement.Infrstructre
{
    public interface IRepository<T> where T : class,new()   
    {
        /// <summary>
        /// 获取所有数据
        /// </summary>
        /// <returns>返回集合</returns>
        Task<ISugarQueryable<T>> GetAll();
        /// <summary>
        /// 没有异步获取所有数据
        /// </summary>
        /// <returns>返回集合</returns>
        List<T> Query();
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity">要添加的实体</param>
        /// <returns>返回受影响行数</returns>
        Task<int> AddAsync(T entity);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity">要修改的实体</param>
        /// <returns>返回受影响行数</returns>
        Task<int> UpdataAsync(T entity);
        /// <summary>
        /// 批量真删除
        /// </summary>
        /// <param name="entities">要删除的实体</param>
        /// <returns>返回受影响行数</returns>
        Task<int> DelRange(List<T> entities);
    }
}
